<template>
	<view :class="['cu-modal','bottom-modal',shows!=show?'show':'']" @tap="hide">
		<view class="cu-dialog">
			<view class="cu-list menu  text-center">

				<!-- <view v-if="item.user_id" class="cu-item">
                	<view class="menu-text">访问 {{item.author.nickname}} 的主页</view>
                </view> -->

				<view v-if="item.text" class="cu-item" @click="copy()">
					<view class="menu-text">复制文本</view>
				</view>

				<view class="cu-item text-center margin-auto" @click="report()">
					<view class="menu-text">
						举报
					</view>
				</view>
				<view class="cu-item">
					<view class="menu-text">取消</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			// 仅代表初始是否显示，实际操作显示请取反
			show: {
				type: Boolean,
				default: false
			},
			type: {
				type: String,
				default: 'cosmos'
			},
			pid: {
				type: String | Number,
				default: 0
			},
			item: {
				type: Array | Object,
				default: {
					id: '',
					author: {
						id: 1,
						nickname: 'admin'
					},
					user_id: 0,
					text: '',
				}

			}
		},
		data() {
			return {
				shows: false
			};
		},
		created() {

		},
		mounted() {
			//挂载
			this.$on('hide', () => {
				this.hide();
			});
		},
		methods: {
			hide() {
				if (this.shows == this.shows) {
					this.shows = !this.shows;
				}
			},
			copy() {
				uni.setClipboardData({
					data: this.item.text,
					success: () => {
						this.$common.showToast('复制成功');
					},
					fail: () => {
						this.$common.showToast('复制失败');
					},
				})
			},
			report() {
				this.$u.route({
					url: '/pages/other/report',
					params: {
						type: this.type,
						id:this.item.id
					}
				})
				// this.$common.showToast('歌者: 感谢您的反馈')
			}
		}
	};
</script>

<style lang="scss">
	.menu-text {
		text-align: center;
		width: 100%;
	}

	.cu-item {
		border-bottom: rgba($color: #ffffff, $alpha: 0.05) 1px solid;
	}
</style>
